vec2 fixuv(in vec2 uv) {
vec2 p = vec2(uv.x / iResolution.x * (iResolution.x / iResolution.y), abs(uv.y / iResolution.y - 1.));
return p;
}


vec3 drawGrid(in vec2 p) {
float f = floor(p.x) + floor(p.y);
vec3 col = mix(vec3(0.75), vec3(0.3), smoothstep(0., 1., mod(f, 2.)));
return col;
}


vec3 drawCurve(in vec2 p,in vec3 col){
  float y=sin(p.x);
  float w=fwidth(p.x)*2.;
  y=1.-exp(-100.*abs(y));
  y=.8+.2*cos(150.*y);
  y=sin(10.*sin(y+20.));
  vec2 pos=vec2(p.x,y);
  col=mix(col,vec3(1.,0.,.8314),smoothstep(w,w*.9,length(p-pos)));
  return col;
}

// 画中心线
vec3 drawCenterLine(in vec2 p, in vec3 col) {
p = (2.0 * p - iResolution.xy) / min(iResolution.x, iResolution.y);
col = mix(col, vec3(1., 0., 0.), smoothstep(abs(p.x), abs(p.x), fwidth(p.x) * 2.));
col = mix(col, vec3(0., 0., 1.), smoothstep(abs(p.y), abs(p.y), fwidth(p.y) * 2.));
return col;
}

vec3 drawDiagonalStripes(in vec2 p,in vec3 col){
    // float px = p.x*20.;
    // float s = mod(floor(px),2.)==0.?10.:30.;
    // vec2 pos =  vec2(p*s);
    // // pos.x+=iTime;
    // float radin = 3.14/180.*45.;

    // // float x = fract(cos(radin)*pos.x+sin(radin)*pos.y );
    // float x = pos. x;
    // // float t = 2.*3.14*0.1;
    // // x=sin(x*t);
    // col =mix(vec3(1),vec3(0),abs(x*2.-1.));

    vec2 pos = p*100.;
    col = vec3(0.);
    col = mix(vec3(1.),col,abs(mod(floor(pos.x),6.)));
    // col = mix(vec3(1.),col,abs(mod(floor(pos.y),5.)));
    // col = mix(col,vec3(1.),abs(1.-mod(floor(pos.y),3.)));

    return col ;
}


void mainImage(out vec4 fragColor,in vec2 fragCoord){
vec2 p = fixuv(fragCoord);
// vec3 col = drawGrid(p);
// col = drawCenterLine(fragCoord,col);
vec3 col ;
col = drawDiagonalStripes(p,col);
fragColor =vec4(col,1.);
}


